package com.cloud.test.region.zuul;

import com.cloud.test.region.zuul.route.GrayZuulLoadBalancerRule;
import com.netflix.loadbalancer.IRule;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @classname: ZuulGrayApplication
 * @description:
 * @author: lds
 * @date: 2020/12/16 11:13
 * @version: V1.0
 */
@EnableZuulProxy
@SpringCloudApplication
public class ZuulGrayApplication {

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean
    IRule grayLoadBalancerRule(){
        return new GrayZuulLoadBalancerRule();
    }

    public static void main(String[] args) {
        new SpringApplicationBuilder(ZuulGrayApplication.class).run(args);
    }
}
